import request from '@/utils/request'

const api = {
 list: '/sys-backup/list',
  query: '/sys-backup/query',
  add: '/sys-backup/add',
  update: '/sys-backup/update',
  delete: '/sys-backup/delete',
  detail: '/sys-backup/detail',
  restore: '/sys-backup/restore',
  download: '/sys-backup/download'
}

export default {
  // 获取系统备份列表
  list(params) {
    return request({
      url: api.list,
      method: 'get',
      params
    })
  },
  
  // 查询系统备份
  query(params) {
    return request({
      url: api.query,
      method: 'get',
      params
    })
  },
  
  // 创建系统备份
  add(data) {
    return request({
      url: api.add,
      method: 'post',
      data
    })
  },
  
  // 删除系统备份
  delete(id) {
    return request({
      url: `${api.delete}/${id}`,
      method: 'delete'
    })
  },
  

  
  // 获取系统备份详情
  detail(id) {
    return request({
      url: `${api.detail}/${id}`,
      method: 'get'
    })
  },
  
  // 恢复备份
  restore(id) {
    return request({
      url: `${api.restore}/${id}`,
      method: 'put'
    })
  },
  
  // 下载备份文件
  download(id) {
    return request({
      url: `${api.download}/${id}`,
      method: 'get',
      responseType: 'blob'
    })
  }
}